﻿using System;
using System.ComponentModel;
using Newtonsoft.Json;

namespace VkApi
{
    public class VkRequestEventArgs : AsyncCompletedEventArgs
    {
        public object Result { get; set; }

        public string Method { get; set; }

        public VkRequestEventArgs(string method, string json)
            : this(method, null, false, null, json)
        {
        }

        public VkRequestEventArgs(string method, Exception error, bool cancelled, object userState, string json)
            : base(error, cancelled, userState)
        {
            Method = method;
            if (error == null && !cancelled)
                Result = JsonConvert.DeserializeObject(json);
        }
    }
}
